<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">




<title>Spring.NET学习笔记18——整合NHibernate(基础篇) Level 300 - 刘冬的备忘录 - 博客园</title>
<meta name="keywords" content="NHibernate,Spring.NET,ORM">



<link title="RSS" type="application/rss+xml" rel="alternate" href="http://www.cnblogs.com/GoodHelper/rss">
<link title="RSD" type="application/rsd+xml" rel="EditURI" href="http://www.cnblogs.com/GoodHelper/rsd.xml"> 
  



<link rel="stylesheet" type="text/css" href="index.css" media="all">
</head>
<body><div style="border: 1px solid rgb(126, 152, 214); margin: 0px; padding: 1px; position: absolute; background-color: rgb(231, 247, 247); font-size: 14px; left: 3px; top: 3px; width: 138px; height: 22px; text-align: center; z-index: 99; display: none;" id="_dict_status"></div><div style="margin: 0px; padding: 0px; position: absolute; display: none; width: 240px; z-index: 98; background-color: rgb(255, 255, 255);" id="_dict_layer"><table style="border: 1px solid rgb(126, 152, 214);" border="0" cellpadding="0" cellspacing="0" width="240"><tbody><tr><td style="border: medium none ; margin: 0px; padding: 0px;" width="100%"><div style="border: medium none ; margin: 0px; padding: 0px; width: 240px; height: 20px; cursor: move; background-color: rgb(200, 218, 243); display: inline;"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="border: medium none ; margin: 0px; padding: 0pt 3px; background-color: rgb(200, 218, 243); color: rgb(26, 145, 0); font-size: 14px; line-height: 20px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" id="_dict_title" name="_dict_title" align="left" height="20" width="60%">划词翻译 - Dict.CN</td><td style="border: medium none ; margin: 0px; padding: 0pt 3px; background-color: rgb(200, 218, 243); line-height: 20px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" align="right" height="20" valign="middle"><a href="http://dict.cn/scb/" target="_top" title="生词本" style="border: medium none ; margin: 0px; padding: 0px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" id="_dict_add" name="_dict_add"><img src="add.gif" style="border: medium none ; margin: 0px; padding: 0px; display: inline;" align="absmiddle" border="0"></a> <a href="http://dict.cn/" target="_top" title="详细解释" style="border: medium none ; margin: 0px; padding: 0px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" id="_dict_detail" name="_dict_detail"><img src="detail.gif" style="border: medium none ; margin: 0px; padding: 0px; display: inline;" align="absmiddle" border="0"></a> <a href="http://dict.cn/foot/help.htm" target="_top" title="帮助" style="border: medium none ; margin: 0px; padding: 0px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;"><img src="help.gif" style="border: medium none ; margin: 0px; padding: 0px; display: inline;" align="absmiddle" border="0"></a> <a href="javascript:_dictClose()" title="关闭" target="_self" style="border: medium none ; margin: 0px; padding: 0px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;"><img src="close.gif" style="border: medium none ; margin: 0px; padding: 0px; display: inline;" align="absmiddle" border="0"></a></td></tr></tbody></table></div><table style="border: medium none ; margin: 0px; padding: 0px;" align="center" border="0" cellpadding="3" cellspacing="4" width="100%"><tbody><tr><td style="border: medium none ; margin: 0px; padding: 0px;"><fieldset color="#00c0ff" style="margin: 0px; padding: 0pt 2px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;"><legend align="center" style="margin: 0px; padding: 0px;"><a href="http://dict.cn/" target="_top" style="border: medium none ; margin: 0px; padding: 0px;"><img src="qdict.gif" border="0" height="53" width="126"></a></legend><table style="border: medium none ; margin: 0px; padding: 0px;" align="center" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border: medium none ; margin: 0px; padding: 0px;" id="_dictContent" name="_dictContent" height="120" width="100%"><iframe id="_dictFrame" name="_dictFrame" src="index_1.html" frameborder="0" height="120" width="100%"></iframe></td></tr><tr align="center"><td style="border: medium none ; margin: 0px; padding: 0px; color: rgb(153, 153, 153); font-size: 10px; line-height: 18px; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" height="18" valign="bottom" width="100%">©2003-2008 <a href="http://dict.cn/" target="_top" style="border: medium none ; margin: 0px; padding: 0px; color: rgb(46, 168, 237); font-size: 10px; line-height: 18px; text-decoration: none; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;">Dict.CN</a> <a href="http://dict.cn/" target="_top" style="border: medium none ; margin: 0px; padding: 0px; color: rgb(153, 153, 153); font-size: 10px; line-height: 18px; text-decoration: none; font-weight: normal; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;">海词</a></td></tr></tbody></table></fieldset></td></tr></tbody></table></td></tr></tbody></table></div>
    <form name="Form1" method="post" action="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html" id="Form1">
<div>
<input name="__EVENTTARGET" id="__EVENTTARGET" value="" type="hidden">
<input name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" type="hidden">
<input name="__VIEWSTATE" id="__VIEWSTATE" value="" type="hidden">
</div>




        
<!--done-->
<div id="home">
<div id="header">
	<div id="blogTitle">
	<a id="lnkBlogLogo" href="http://www.cnblogs.com/GoodHelper/"><img id="blogLogo" src="logo.gif" alt="返回主页"></a>			
		
<!--done-->
<h1><a id="Header1_HeaderTitle" class="headermaintitle" href="http://www.cnblogs.com/GoodHelper/">刘冬的备忘录</a></h1>
<h2>打造新疆第一敏捷团队</h2>



		
	</div><!--end: blogTitle 博客的标题和副标题 -->
	<div id="navigator">
		
<!--done-->
			<ul id="navList">
				<li><a id="MyLinks1_HomeLink" class="menu" href="http://www.cnblogs.com/">博客园</a></li>
				<li><a id="MyLinks1_SpaceLink" class="menu" href="http://space.cnblogs.com/">社区</a></li>
				<li><a id="MyLinks1_MyHomeLink" class="menu" href="http://www.cnblogs.com/GoodHelper/">首页</a></li>
				<li><a id="MyLinks1_NewPostLink" class="menu" href="http://www.cnblogs.com/GoodHelper/admin/EditPosts.aspx?opt=1">新随笔</a></li>
				<li><a id="MyLinks1_ContactLink" accesskey="9" class="menu" href="http://space.cnblogs.com/msg/send/%e5%88%98%e5%86%ac.NET">联系</a></li>
				<li><a id="MyLinks1_Admin" class="menu" href="http://www.cnblogs.com/GoodHelper/admin/EditPosts.aspx">管理</a></li>
				<li><a id="MyLinks1_Syndication" class="menu" href="http://www.cnblogs.com/GoodHelper/rss">订阅</a>
				<a id="MyLinks1_XMLLink" class="aHeaderXML" href="http://www.cnblogs.com/GoodHelper/rss"><img src="rss.gif" alt="订阅" style="border-width: 0px;"></a></li>
			</ul>


		<div class="blogStats">
			
			
<!--done-->
随笔- 32&nbsp;
文章- 2&nbsp;
评论- 226&nbsp;

			
		</div><!--end: blogStats -->
	</div><!--end: navigator 博客导航栏 -->
</div><!--end: header 头部 -->

<div id="main">
	<div id="mainContent">
	<div class="forFlow">
		
					
<!--done-->
<div id="topics">
	<div class="post">
		<h1 class="postTitle">
			<a id="ctl04_TitleUrl" class="postTitle2" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html">Spring.NET学习笔记18——整合NHibernate(基础篇) Level 300</a>
		</h1>
		<div class="clear"></div>
		<div class="postBody">
			<p>　　<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>是一个基于.Net的针对关系型数据库的对象持久化(<strong>ORM</strong>)类库。<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>来源于非常优秀的基于Java的<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>关系型持久化工具。<strong></strong>从数据库底<a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a>来持久化你的.Net 对象到关系型数据库。<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>为你处理这些，远胜于你不得不写SQL去从数据库存取对象。你的代码仅仅和对象关联，<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>自动产生SQL语句，并确保对象提交到正确的表和字段中去。</p>
<p>　　<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>对<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>提供了很好的支持与封装。<span style="color: rgb(51, 102, 255);">Spring.Data.NHibernate.Generic.Support</span>和<span style="color: rgb(51, 102, 255);">Spring.Data.NHibernate.Support</span>下的<span style="color: rgb(51, 102, 255);">HibernateDaoSupport</span>是Spring.NET提供的数据库访问对象(<strong>DAO</strong>)的基类，两者的却别在于对泛型的支持程度。我们以<span style="color: rgb(51, 102, 255);">Spring.Data.NHibernate.Generic.Support.HibernateDaoSupport</span>为例，讲解Spring.NET整合<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>开发。</p>
<p>　　我归纳了一下，分为三个步骤：</p>
<p>　　一、实体对象的建立及配置</p>
<p>　　二、数据访问对象建立及配置</p>
<p>　　三、业务处理层建立及配置</p>
<p>&nbsp;</p>
<p>　　首先让我们学习一下<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>的实体对象的映射：我建立两个实体“用户信息”和“公司信息”。图1所示。</p>
<p><img alt="" src="2009-11-18.01.gif" border="0">图1</p>
<p>　　</p>
<p>&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_025638" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_025638').style.display='none'; document.getElementById('Code_Open_Image_025638').style.display='inline'; document.getElementById('Code_Open_Text_025638').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_025638" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_025638').style.display='none'; getElementById('Code_Closed_Image_025638').style.display='inline'; getElementById('Code_Closed_Text_025638').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_025638">Model</span><span id="Code_Open_Text_025638" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;User<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">virtual</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">?</span><span style="color: rgb(0, 0, 0);">&nbsp;UserID&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">virtual</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">&nbsp;UserName&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">virtual</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">&nbsp;UserAge&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">virtual</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">&nbsp;UserSex&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">virtual</span><span style="color: rgb(0, 0, 0);">&nbsp;Company&nbsp;CurrentCompany&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;Company<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">virtual</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">?</span><span style="color: rgb(0, 0, 0);">&nbsp;CompanyID&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">virtual</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">&nbsp;CompanyName&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">virtual</span><span style="color: rgb(0, 0, 0);">&nbsp;IList</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">User</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">&nbsp;UserList&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></div>
<p>　　<br>　　<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>要求实体必须是带有无参构造函数和带有<span style="color: rgb(0, 0, 255);">virtual</span>修饰的属性。两个实体的关系是双向(一对多——多对一)映射关系。</p>
<p>&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_030021" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_030021').style.display='none'; document.getElementById('Code_Open_Image_030021').style.display='inline'; document.getElementById('Code_Open_Text_030021').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_030021" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_030021').style.display='none'; getElementById('Code_Closed_Image_030021').style.display='inline'; getElementById('Code_Closed_Text_030021').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_030021">xxx.hbm.xml</span><span id="Code_Open_Text_030021" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">hibernate-mapping&nbsp;</span><span style="color: rgb(255, 0, 0);">xmlns</span><span style="color: rgb(0, 0, 255);">="urn:nhibernate-mapping-2.2"</span><span style="color: rgb(255, 0, 0);">&nbsp;assembly</span><span style="color: rgb(0, 0, 255);">="Model"</span><span style="color: rgb(255, 0, 0);">&nbsp;namespace</span><span style="color: rgb(0, 0, 255);">="Model"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">class&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Model.User,&nbsp;Model"</span><span style="color: rgb(255, 0, 0);">&nbsp;table</span><span style="color: rgb(0, 0, 255);">="UserInfo"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">id&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="UserID"</span><span style="color: rgb(255, 0, 0);">&nbsp;column</span><span style="color: rgb(0, 0, 255);">="UserID"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="int"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">generator&nbsp;</span><span style="color: rgb(255, 0, 0);">class</span><span style="color: rgb(0, 0, 255);">="native"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="UserName"</span><span style="color: rgb(255, 0, 0);">&nbsp;column</span><span style="color: rgb(0, 0, 255);">="UserName"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="string"</span><span style="color: rgb(255, 0, 0);">&nbsp;length</span><span style="color: rgb(0, 0, 255);">="50"</span><span style="color: rgb(255, 0, 0);">&nbsp;not-null</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="UserAge"</span><span style="color: rgb(255, 0, 0);">&nbsp;column</span><span style="color: rgb(0, 0, 255);">="UserAge"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="int"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="UserSex"</span><span style="color: rgb(255, 0, 0);">&nbsp;column</span><span style="color: rgb(0, 0, 255);">="UserSex"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="bool"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">many-to-one&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="CurrentCompany"</span><span style="color: rgb(255, 0, 0);">&nbsp;class</span><span style="color: rgb(0, 0, 255);">="Model.Company,&nbsp;Model"</span><span style="color: rgb(255, 0, 0);">&nbsp;foreign-key</span><span style="color: rgb(0, 0, 255);">="FK_UserInfo_CompanyInfo"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">column&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="CompanyID"</span><span style="color: rgb(255, 0, 0);">&nbsp;not-null</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">many-to-one</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">class</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">hibernate-mapping</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br><br></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">hibernate-mapping&nbsp;</span><span style="color: rgb(255, 0, 0);">xmlns</span><span style="color: rgb(0, 0, 255);">="urn:nhibernate-mapping-2.2"</span><span style="color: rgb(255, 0, 0);">&nbsp;assembly</span><span style="color: rgb(0, 0, 255);">="Model"</span><span style="color: rgb(255, 0, 0);">&nbsp;namespace</span><span style="color: rgb(0, 0, 255);">="Model"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">class&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Model.Company,&nbsp;Model"</span><span style="color: rgb(255, 0, 0);">&nbsp;table</span><span style="color: rgb(0, 0, 255);">="CompanyInfo"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">id&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="CompanyID"</span><span style="color: rgb(255, 0, 0);">&nbsp;column</span><span style="color: rgb(0, 0, 255);">="CompanyID"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="int"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">generator&nbsp;</span><span style="color: rgb(255, 0, 0);">class</span><span style="color: rgb(0, 0, 255);">="native"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="CompanyName"</span><span style="color: rgb(255, 0, 0);">&nbsp;column</span><span style="color: rgb(0, 0, 255);">="Name"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="string"</span><span style="color: rgb(255, 0, 0);">&nbsp;not-null</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);">&nbsp;length</span><span style="color: rgb(0, 0, 255);">="50"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">bag&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="UserList"</span><span style="color: rgb(255, 0, 0);">&nbsp;inverse</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);">&nbsp;cascade</span><span style="color: rgb(0, 0, 255);">="all-delete-orphan"</span><span style="color: rgb(255, 0, 0);">&nbsp;table</span><span style="color: rgb(0, 0, 255);">="UserInfo"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">key&nbsp;</span><span style="color: rgb(255, 0, 0);">column</span><span style="color: rgb(0, 0, 255);">="CompanyID"</span><span style="color: rgb(255, 0, 0);">&nbsp;foreign-key</span><span style="color: rgb(0, 0, 255);">="FK_UserInfo_CompanyInfo"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">one-to-many&nbsp;</span><span style="color: rgb(255, 0, 0);">class</span><span style="color: rgb(0, 0, 255);">="Model.User,&nbsp;Model"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">bag</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">class</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">hibernate-mapping</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br></span></span></div>
<p>&nbsp;</p>
<p>　　以上就是实体对象与数据的映射文件，提供的配置我不详细说明，请查看<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>的帮助手册。</p>
<p>　　接下来，我建立数据库访问对象(<strong>DAO</strong>)层。在这里我使用了泛型<strong>Repository</strong>模式。</p>
<p>&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_030501" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_030501').style.display='none'; document.getElementById('Code_Open_Image_030501').style.display='inline'; document.getElementById('Code_Open_Text_030501').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_030501" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_030501').style.display='none'; getElementById('Code_Closed_Image_030501').style.display='inline'; getElementById('Code_Closed_Text_030501').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_030501">Repository</span><span id="Code_Open_Text_030501" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">interface</span><span style="color: rgb(0, 0, 0);">&nbsp;IRepository</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">T</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Delete(T&nbsp;entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T&nbsp;Get(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;id);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;Save(T&nbsp;entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Update(T&nbsp;entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;NHibernateRepository</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">T</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">&nbsp;:&nbsp;HibernateDaoSupport,&nbsp;IRepository</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">T</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;Save(T&nbsp;entity)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.HibernateTemplate.Save(entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;T&nbsp;Get(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;id)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.HibernateTemplate.Get</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">T</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">(id);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Update(T&nbsp;entity)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.HibernateTemplate.Update(entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Delete(T&nbsp;entity)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.HibernateTemplate.Delete(entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></div>
<p>&nbsp;</p>
<p>　　数据库访问对象我们可以让它继承于<span style="color: rgb(51, 102, 255);">HibernateDaoSupport</span>类，该类的<span style="color: rgb(51, 102, 255);">HibernateTemplate</span>属性我们可以通过<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>从外部注入。</p>
<p>&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_030751" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_030751').style.display='none'; document.getElementById('Code_Open_Image_030751').style.display='inline'; document.getElementById('Code_Open_Text_030751').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_030751" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_030751').style.display='none'; getElementById('Code_Closed_Image_030751').style.display='inline'; getElementById('Code_Closed_Text_030751').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_030751">Repository.xml</span><span id="Code_Open_Text_030751" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 255);">&lt;?</span><span style="color: rgb(255, 0, 255);">xml&nbsp;version="1.0"&nbsp;encoding="utf-8"&nbsp;</span><span style="color: rgb(0, 0, 255);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">objects&nbsp;</span><span style="color: rgb(255, 0, 0);">xmlns</span><span style="color: rgb(0, 0, 255);"><span>="<a href="http://www.springframework.net/" class="smarterwiki-linkify">http://www.springframework.net</a>"</span></span><span style="color: rgb(255, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:db</span><span style="color: rgb(0, 0, 255);"><span>="<a href="http://www.springframework.net/database" class="smarterwiki-linkify">http://www.springframework.net/database</a>"</span></span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">&nbsp;用以我们在其它的应用程序中，配置数据访问&nbsp;</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer,&nbsp;Spring.Core"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="ConfigSections"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="databaseSettings"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">&nbsp;数据库和Nhibernate的相关配置&nbsp;</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">db:provider&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="DbProvider"</span><span style="color: rgb(255, 0, 0);">&nbsp;provider</span><span style="color: rgb(0, 0, 255);">="SqlServer-1.1"</span><span style="color: rgb(255, 0, 0);">&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connectionString</span><span style="color: rgb(0, 0, 255);">="Server=${db.datasource};database=${db.database};uid=${db.user};pwd=${db.password};"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">SessionFactory对象，其中包括一些比较重要的属性&nbsp;</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="NHibernateSessionFactory"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Data.NHibernate.LocalSessionFactoryObject,&nbsp;Spring.Data.NHibernate21"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="DbProvider"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="DbProvider"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="MappingAssemblies"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Model</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="HibernateProperties"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">dictionary</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="hibernate.connection.provider"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="NHibernate.Connection.DriverConnectionProvider"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="dialect"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="NHibernate.Dialect.MsSql2000Dialect"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="hibernate.connection.driver_class"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="NHibernate.Driver.SqlClientDriver"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="use_outer_join"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="show_sql"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">自动建表(反向映射)</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="hbm2ddl.auto"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="update"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="adonet.batch_size"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="10"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="command_timeout"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="60"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">显式启用二级缓存</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="cache.use_second_level_cache"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">启动查询缓存</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="cache.use_query_cache"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="query.substitutions"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="true&nbsp;1,&nbsp;false&nbsp;0,&nbsp;yes&nbsp;'Y',&nbsp;no&nbsp;'N"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">entry&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="proxyfactory.factory_class"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="NHibernate.ByteCode.Castle.ProxyFactoryFactory,&nbsp;NHibernate.ByteCode.Castle"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">dictionary</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="ExposeTransactionAwareSessionFactory"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="HibernateTemplate"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Data.NHibernate.Generic.HibernateTemplate"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="SessionFactory"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="NHibernateSessionFactory"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="TemplateFlushMode"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="Auto"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="CacheQueries"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="repository.user"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Repository.NHibernateRepository&amp;lt;Model.User&gt;,&nbsp;Repository"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="HibernateTemplate"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="HibernateTemplate"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="repository.company"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Repository.NHibernateRepository&amp;lt;Model.Company&gt;,&nbsp;Repository"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="HibernateTemplate"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="HibernateTemplate"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br><br></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">objects</span><span style="color: rgb(0, 0, 255);">&gt;</span></span></div>
<p>&nbsp;</p>
<p>　　<span style="color: rgb(128, 0, 0);">db:provider</span>节点是数据的连接字符串配置，我们引入xmlns:db="<a href="http://www.springframework.net/database" target="_top">http://www.springframework.net/database</a>这项命名空间便可以使用它。其中<span style="color: rgb(255, 0, 0);">provider</span>属性为数据库提供者的名称。以下是<span style="color: rgb(255, 0, 0);">provider</span>的详细情况：</p>
<p align="center">
</p><table class="MsoTableGrid" style="border: medium none ; border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0">
<tbody><tr style="height: 15.1pt;">
<td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 213.05pt; height: 15.1pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="font-family: 宋体;">名称</span></p></td>
<td style="border-style: solid solid solid none; border-color: windowtext windowtext windowtext rgb(212, 208, 200); border-width: 1pt 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; height: 15.1pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="font-family: 宋体;">介绍</span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">SqlServer-1.1</font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Microsoft SQL Server, provider V<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">1.0.5</st1:chsdate>.0 in framework .NET V1.1</font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">SqlServer-2.0<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Microsoft SQL Server, provider V<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">2.0.0</st1:chsdate>.0 in framework .NET V2.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">SqlServerCe-3.1<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Microsoft SQL Server Compact Edition, provider V9.0.242.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">SqlServerCe-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">3.5.1</st1:chsdate><o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Microsoft SQL Server Compact Edition, provider V<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">3.5.1</st1:chsdate>.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">OleDb-1.1<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">provider V1.0.<st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="True" sourcevalue="5000" unitname="in">5000.0 in</st1:chmetcnv> framework .NET V1.1<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">OleDb-2.0<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">provider V<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">2.0.0</st1:chsdate>.0 in framework .NET V2.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">OracleClient-2.0<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Oracle, Microsoft provider V<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">2.0.0</st1:chsdate>.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">OracleODP-2.0<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Oracle, Oracle provider V2.102.2.20<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">MySql<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">MySQL provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">1.0.10</st1:chsdate>.1<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">MySql-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">1.0.9</st1:chsdate><o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">MySQL provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">1.0.9</st1:chsdate><o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">MySql-5.0<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">MySQL provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">5.0.7</st1:chsdate>.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">MySql-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">5.0.8</st1:chsdate>.1<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">MySQL provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">5.0.8</st1:chsdate>.1<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">MySql-5.1<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">MySQL provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">5.1.2</st1:chsdate>.2<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">MySql-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">5.1.4</st1:chsdate><o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">MySQL provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">5.1.2</st1:chsdate>.2<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">MySql-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">5.2.3</st1:chsdate><o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">MySQL provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">5.2.3</st1:chsdate>.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">Npgsql-1.0<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Postgresql provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">1.0.0</st1:chsdate>.0 (and 1.0.0.1 - were build with same version info)<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">Npgsql-2.0</font></span></code><span style="" lang="EN"><font face="Times New Roman"> </font></span><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">-beta1<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Postgresql provider 1.98.1.0 beta 1<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">Npgsql-2.0<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Postgresql provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">2.0.0</st1:chsdate>.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">DB2-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">9.0.0</st1:chsdate>-1.1<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">IBM DB2 Data Provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">9.0.0</st1:chsdate> for .NET Framework 1.1<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">DB2-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">9.0.0</st1:chsdate>-2.0<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">IBM DB2 Data Provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">9.0.0</st1:chsdate> for .NET Framework 2.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">DB2-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">9.1.0</st1:chsdate>-1.1<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">IBM DB2 Data Provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">9.1.0</st1:chsdate> for .NET Framework 1.1<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">DB2-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">9.1.0</st1:chsdate>.2<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">IBM DB2 Data Provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">9.1.0</st1:chsdate> for .NET Framework 2.<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">SQLite-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">1.0.43</st1:chsdate><o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">SQLite provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">1.0.43</st1:chsdate> for .NET Framework 2.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">SQLite-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">1.0.47</st1:chsdate><o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">SQLite provider <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">1.0.43</st1:chsdate> for .NET Framework 2.0<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">SybaseAse-12<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Sybase ASE provider for ASE 12.x<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">SybaseAse-15<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Sybase ASE provider for ASE 15.x<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">SybaseAse-AdoNet2<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Sybase ADO.NET 2.0 provider for ASE 12.x and 15.x<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">Odbc-1.1<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">ODBC provider V1.0.<st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="True" sourcevalue="5000" unitname="in">5000.0 in</st1:chmetcnv> framework .NET V1.1<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><code><span style="font-size: 12pt;" lang="EN"><font face="宋体">Odbc-2.0<o:p></o:p></font></span></code></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">ODBC provider V<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">2.0.0</st1:chsdate>.0 in framework .NET V2<o:p></o:p></font></span></p></td></tr>
<tr style="">
<td style="border-style: none solid solid; border-color: rgb(212, 208, 200) windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><font face="Times New Roman"><span style="" lang="EN">InterSystems.Data.CacheClient</span><code><span style="font-size: 12pt;" lang="EN"><o:p></o:p></span></code></font></p></td>
<td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 213.05pt; background-color: transparent;" valign="top" width="284">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span style="" lang="EN"><font face="Times New Roman">Caché provider Version <st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">2.0.0</st1:chsdate>.1 in framework .NET V2<o:p></o:p></font></span></p></td></tr></tbody></table>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;" align="center"><span lang="EN-US"><o:p><font face="Times New Roman">&nbsp;</font></o:p></span></p>
<p align="left">　　可以根据自己的数据库选择不同的提供者名称。<span style="color: rgb(255, 0, 0);">connectionString</span>属性为数据库的连接字符串，这里用<span style="color: rgb(255, 0, 0);">${xxx}</span>的方式来表示一个占位符，因为我们经常将<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>的配置文件设置为“嵌入系统资源”，这样一来在程序编译后就不能够修改，所以我们就要在应用程序配置文件中填写连接字符串，而不是在<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>的配置文件中填写。</p>
<p align="left">&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_033118" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_033118').style.display='none'; document.getElementById('Code_Open_Image_033118').style.display='inline'; document.getElementById('Code_Open_Text_033118').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_033118" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_033118').style.display='none'; getElementById('Code_Closed_Image_033118').style.display='inline'; getElementById('Code_Closed_Text_033118').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_033118">App.config</span><span id="Code_Open_Text_033118" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">configuration</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">configSections</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">section&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="databaseSettings"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="System.Configuration.NameValueSectionHandler"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">configSections</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">数据库连接字符串</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">databaseSettings</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="db.datasource"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="."</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="db.user"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="sa"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="db.password"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">=""</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="db.database"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="SpringNet_Lesson18"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">databaseSettings</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">configuration</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br></span></span></div>
<p align="left">&nbsp;　　</p>
<p align="left">　　<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>中的Session控制取决于<span style="color: rgb(51, 102, 255);">SessionFactory</span>，<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>提供了<span style="color: rgb(51, 102, 255);">LocalSessionFactoryObject</span>类来统一管理<span style="color: rgb(51, 102, 255);">SessionFactory</span>。其中<span style="color: rgb(0, 0, 255);">MappingAssemblies</span>属性为实体程序集的名称，可以填写多个名称。<span style="color: rgb(0, 0, 255);">HibernateProperties</span><span style="color: rgb(0, 0, 0);">为</span><strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>的配置，<span style="color: rgb(0, 0, 255);">dialect</span>属性为数据库的方言，因为是SQL server 2K数据库，所以使用<span style="color: rgb(0, 0, 255);">NHibernate.Dialect.MsSql2000Dialect&nbsp;</span>。<span style="color: rgb(0, 0, 255);">proxyfactory.factory_class</span>属性为延迟加载的代理类驱动，在<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a>&nbsp;</strong>2.1版中必须配置。<span style="color: rgb(0, 0, 255);">hbm2ddl.auto</span>属性为反向建立映射表的配置，我们配置为<span style="color: rgb(0, 0, 255);">update</span>后，<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>会帮我们自动根据实体的结构生成数据库中的表。</p>
<p align="left">&nbsp;</p>
<p align="left">　　接下来我们看一下业务处理层。</p>
<p align="left">&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_034333" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_034333').style.display='none'; document.getElementById('Code_Open_Image_034333').style.display='inline'; document.getElementById('Code_Open_Text_034333').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_034333" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_034333').style.display='none'; getElementById('Code_Closed_Image_034333').style.display='inline'; getElementById('Code_Closed_Text_034333').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_034333">UserManager</span><span id="Code_Open_Text_034333" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">interface</span><span style="color: rgb(0, 0, 0);">&nbsp;IUserManager<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Delete(User&nbsp;entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User&nbsp;Get(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;id);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;Save(User&nbsp;entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Update(User&nbsp;entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IRepository</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">User</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">&nbsp;UserRepository&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;UserManager&nbsp;:&nbsp;IUserManager<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;IRepository</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">User</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">&nbsp;UserRepository&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;Save(User&nbsp;entity)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.UserRepository.Save(entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Delete(User&nbsp;entity)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.UserRepository.Delete(entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;User&nbsp;Get(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;id)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.UserRepository.Get(id);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Update(User&nbsp;entity)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.UserRepository.Update(entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></div>
<p align="left">&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_034421" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_034421').style.display='none'; document.getElementById('Code_Open_Image_034421').style.display='inline'; document.getElementById('Code_Open_Text_034421').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_034421" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_034421').style.display='none'; getElementById('Code_Closed_Image_034421').style.display='inline'; getElementById('Code_Closed_Text_034421').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_034421">CompanyManager</span><span id="Code_Open_Text_034421" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">interface</span><span style="color: rgb(0, 0, 0);">&nbsp;ICompanyManager<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Delete(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;id);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Company&nbsp;Get(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;id);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;Save(Company&nbsp;entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Update(Company&nbsp;entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;CompanyManager&nbsp;:&nbsp;ICompanyManager<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;IRepository</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">Company</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">&nbsp;CompanyRepository&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;Save(Company&nbsp;entity)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.CompanyRepository.Save(entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Delete(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;id)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.CompanyRepository.Delete(</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.Get(id));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;Company&nbsp;Get(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">&nbsp;id)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.CompanyRepository.Get(id);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Update(Company&nbsp;entity)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Company&nbsp;company&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.Get(entity.CompanyID);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;company.CompanyName&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;entity.CompanyName;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.CompanyRepository.Update(company);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></div>
<p align="left">&nbsp;</p>
<p align="left">　　代码的编写我不仔细讲，我们主要学习一下相关的配置。</p>
<p align="left">&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_034617" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_034617').style.display='none'; document.getElementById('Code_Open_Image_034617').style.display='inline'; document.getElementById('Code_Open_Text_034617').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_034617" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_034617').style.display='none'; getElementById('Code_Closed_Image_034617').style.display='inline'; getElementById('Code_Closed_Text_034617').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_034617">Manager.xml</span><span id="Code_Open_Text_034617" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 255);">&lt;?</span><span style="color: rgb(255, 0, 255);">xml&nbsp;version="1.0"&nbsp;encoding="utf-8"&nbsp;</span><span style="color: rgb(0, 0, 255);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">objects&nbsp;</span><span style="color: rgb(255, 0, 0);">xmlns</span><span style="color: rgb(0, 0, 255);"><span>="<a href="http://www.springframework.net/" class="smarterwiki-linkify">http://www.springframework.net</a>"</span></span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="transactionManager"</span><span style="color: rgb(255, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Data.NHibernate.HibernateTransactionManager,&nbsp;Spring.Data.NHibernate21"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="DbProvider"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="DbProvider"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="SessionFactory"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="NHibernateSessionFactory"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="transactionInterceptor"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Transaction.Interceptor.TransactionInterceptor,&nbsp;Spring.Data"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="TransactionManager"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="transactionManager"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="TransactionAttributeSource"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource,&nbsp;Spring.Data"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="BaseTransactionManager"</span><span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Transaction.Interceptor.TransactionProxyFactoryObject,&nbsp;Spring.Data"</span><span style="color: rgb(255, 0, 0);">&nbsp;abstract</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="PlatformTransactionManager"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="transactionManager"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="TransactionAttributes"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">name-values</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="Save*"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="PROPAGATION_REQUIRED"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="Set*"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="PROPAGATION_REQUIRED"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="Finish*"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="PROPAGATION_REQUIRED"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="Update*"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="PROPAGATION_REQUIRED"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="Delete*"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="PROPAGATION_REQUIRED"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="Add*"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="PROPAGATION_REQUIRED"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="Get*"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="PROPAGATION_SUPPORTS,readOnly"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="Find*"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="PROPAGATION_SUPPORTS,readOnly"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="Load*"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="PROPAGATION_SUPPORTS,readOnly"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="*"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="PROPAGATION_REQUIRED"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">name-values</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="CompanyManager"</span><span style="color: rgb(255, 0, 0);">&nbsp;parent</span><span style="color: rgb(0, 0, 255);">="BaseTransactionManager"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Target"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="Manager.CompanyManager,Manager"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="CompanyRepository"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="repository.company"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="UserManager"</span><span style="color: rgb(255, 0, 0);">&nbsp;parent</span><span style="color: rgb(0, 0, 255);">="BaseTransactionManager"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Target"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">object&nbsp;</span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="Manager.UserManager,Manager"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="UserRepository"</span><span style="color: rgb(255, 0, 0);">&nbsp;ref</span><span style="color: rgb(0, 0, 255);">="repository.user"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">object</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">objects</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br></span></span></div>
<p>&nbsp;</p>
<p>　　我们在前几篇学过<a href="http://www.cnblogs.com/GoodHelper/tag/AOP/" target="_top">AOP</a>拦截和事务代理。<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>为<strong><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/" target="_top"><strong>NHibernate</strong></a></strong>提供的事务代理是<span style="color: rgb(51, 102, 255);">TransactionProxyFactoryObject</span>。我们将改类的<span style="color: rgb(0, 0, 255);">Target</span>熟悉注入业务处理层的类，这样<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/" target="_top">Spring.NET</a>会为该类包装上事务。</p>
<p>&nbsp;</p>
<p>　　最后我们写一个单元测试类，对业务层进行单元测试。</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_035437" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_035437').style.display='none'; document.getElementById('Code_Open_Image_035437').style.display='inline'; document.getElementById('Code_Open_Text_035437').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_035437" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_035437').style.display='none'; getElementById('Code_Closed_Image_035437').style.display='inline'; getElementById('Code_Closed_Text_035437').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_035437">UserManagerTest </span><span id="Code_Open_Text_035437" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">[TestFixture]<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;UserManagerTest&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);">&nbsp;log4net.ILog&nbsp;logger&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;log4net.LogManager.GetLogger(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Logger</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[SetUp]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;SetUp()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log4net.Config.XmlConfigurator.Configure();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IApplicationContext&nbsp;applicationContext&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ContextRegistry.GetContext();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;userManager&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;(IUserManager)applicationContext.GetObject(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">UserManager</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;companyManager&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;(ICompanyManager)applicationContext.GetObject(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">CompanyManager</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);">&nbsp;(Exception&nbsp;ex)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.Error(ex);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;ex;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);">&nbsp;IUserManager&nbsp;userManager;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);">&nbsp;ICompanyManager&nbsp;companyManager;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Test]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Delete()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;userManager.Delete(userManager.Get(</span><span style="color: rgb(128, 0, 128);">2</span><span style="color: rgb(0, 0, 0);">));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Test]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Get()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User&nbsp;user&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;userManager.Get(</span><span style="color: rgb(128, 0, 128);">1</span><span style="color: rgb(0, 0, 0);">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Test]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Save()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User&nbsp;user&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;User();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user.UserName&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">刘冬</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user.CurrentCompany&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;companyManager.Get(</span><span style="color: rgb(128, 0, 128);">1</span><span style="color: rgb(0, 0, 0);">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;userManager.Save(user);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Test]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Update()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User&nbsp;user&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;userManager.Get(</span><span style="color: rgb(128, 0, 128);">1</span><span style="color: rgb(0, 0, 0);">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user.UserName&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">刘冬冬</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;userManager.Update(user);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></div>
<p>&nbsp;</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_035512" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_035512').style.display='none'; document.getElementById('Code_Open_Image_035512').style.display='inline'; document.getElementById('Code_Open_Text_035512').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_035512" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_035512').style.display='none'; getElementById('Code_Closed_Image_035512').style.display='inline'; getElementById('Code_Closed_Text_035512').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_035512">CompanyManagerTest </span><span id="Code_Open_Text_035512" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 0);">[TestFixture]<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;CompanyManagerTest&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);">&nbsp;log4net.ILog&nbsp;logger&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;log4net.LogManager.GetLogger(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Logger</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[SetUp]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;SetUp()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log4net.Config.XmlConfigurator.Configure();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IApplicationContext&nbsp;applicationContext&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ContextRegistry.GetContext();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;companyManager&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;(ICompanyManager)applicationContext.GetObject(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">CompanyManager</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);">&nbsp;(Exception&nbsp;ex)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.Error(ex);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;ex;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);">&nbsp;ICompanyManager&nbsp;companyManager;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Test]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Delete()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;companyManager.Delete(</span><span style="color: rgb(128, 0, 128);">4</span><span style="color: rgb(0, 0, 0);">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Test]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Get()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Company&nbsp;company&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;companyManager.Get(</span><span style="color: rgb(128, 0, 128);">1</span><span style="color: rgb(0, 0, 0);">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Test]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Save()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Company&nbsp;company&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;Company();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;company.CompanyName&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">刘冬公司</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;companyManager.Save(company);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Test]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Update()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Company&nbsp;company&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;companyManager.Get(</span><span style="color: rgb(128, 0, 128);">1</span><span style="color: rgb(0, 0, 0);">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;company.CompanyName&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">刘冬冬公司</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;companyManager.Update(company);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></div>
<p>&nbsp;</p>
<p>　　配置文件：</p>
<div class="cnblogs_code"><img style="display: none;" id="Code_Closed_Image_035602" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_035602').style.display='none'; document.getElementById('Code_Open_Image_035602').style.display='inline'; document.getElementById('Code_Open_Text_035602').style.display='inline';" src="contractedblock.gif" align="top" height="16" width="11"><img id="Code_Open_Image_035602" style="display: inline;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_035602').style.display='none'; getElementById('Code_Closed_Image_035602').style.display='inline'; getElementById('Code_Closed_Text_035602').style.display='inline';" src="expandedblockstart.gif" align="top" height="16" width="11"><span style="display: none;" class="cnblogs_code_Collapse" id="Code_Closed_Text_035602">App.config</span><span id="Code_Open_Text_035602" style="display: inline;"><br><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: rgb(0, 0, 255);">&lt;?</span><span style="color: rgb(255, 0, 255);">xml&nbsp;version="1.0"&nbsp;encoding="utf-8"&nbsp;</span><span style="color: rgb(0, 0, 255);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">configuration</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;<br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">configSections</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">sectionGroup&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="spring"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">section&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="context"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Context.Support.ContextHandler,&nbsp;Spring.Core"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">section&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="objects"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Context.Support.DefaultSectionHandler,&nbsp;Spring.Core"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">section&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="parsers"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="Spring.Context.Support.NamespaceParsersSectionHandler,&nbsp;Spring.Core"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">sectionGroup</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">section&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="databaseSettings"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="System.Configuration.NameValueSectionHandler"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">section&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="log4net"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="log4net.Config.Log4NetConfigurationSectionHandler,log4net"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">configSections</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">spring</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">parsers</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">parser&nbsp;</span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="Spring.Data.Config.DatabaseNamespaceParser,&nbsp;Spring.Data"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">parser&nbsp;</span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="Spring.Transaction.Config.TxNamespaceParser,&nbsp;Spring.Data"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">parsers</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">context</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">resource&nbsp;</span><span style="color: rgb(255, 0, 0);">uri</span><span style="color: rgb(0, 0, 255);">="assembly://Repository/Repository/Repository.xml"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">resource&nbsp;</span><span style="color: rgb(255, 0, 0);">uri</span><span style="color: rgb(0, 0, 255);">="assembly://Manager/Manager/Manager.xml"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">context</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">spring</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">log4net</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">appender&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="ConsoleAppender"</span><span style="color: rgb(255, 0, 0);">&nbsp;type</span><span style="color: rgb(0, 0, 255);">="log4net.Appender.ConsoleAppender"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">layout&nbsp;</span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="log4net.Layout.PatternLayout"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">conversionPattern&nbsp;</span><span style="color: rgb(255, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">="%-5level&nbsp;%logger&nbsp;-&nbsp;%message%newline"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">layout</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">appender</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">&nbsp;Set&nbsp;default&nbsp;logging&nbsp;level&nbsp;to&nbsp;DEBUG&nbsp;</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">root</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">level&nbsp;</span><span style="color: rgb(255, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">="DEBUG"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">appender-ref&nbsp;</span><span style="color: rgb(255, 0, 0);">ref</span><span style="color: rgb(0, 0, 255);">="ConsoleAppender"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">root</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">&nbsp;Set&nbsp;logging&nbsp;for&nbsp;Spring.&nbsp;&nbsp;Logger&nbsp;names&nbsp;in&nbsp;Spring&nbsp;correspond&nbsp;to&nbsp;the&nbsp;namespace&nbsp;</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">logger&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Spring"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">level&nbsp;</span><span style="color: rgb(255, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">="INFO"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">logger</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">logger&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Spring.Data"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">level&nbsp;</span><span style="color: rgb(255, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">="DEBUG"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">logger</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">logger&nbsp;</span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="NHibernate"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">level&nbsp;</span><span style="color: rgb(255, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">="INFO"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">logger</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">log4net</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">数据库连接字符串</span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">databaseSettings</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="db.datasource"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="."</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="db.user"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="sa"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="db.password"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">=""</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add&nbsp;</span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="db.database"</span><span style="color: rgb(255, 0, 0);">&nbsp;value</span><span style="color: rgb(0, 0, 255);">="SpringNet_Lesson18"</span><span style="color: rgb(255, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br>&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">databaseSettings</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br><br></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">configuration</span><span style="color: rgb(0, 0, 255);">&gt;</span></span></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>　　<a style="color: rgb(128, 128, 0);" href="http://download.csdn.net/source/1825080" target="_top">代码下载</a></p>
<p align="left">&nbsp;</p>
<p align="left">　　数据库我没有上传，因为空间的问题。我设置了自动建表的属性，可以用来自动创建数据库表结构。</p>
<p align="left">&nbsp;</p>
<p align="left">　　<a href="http://www.cnblogs.com/GoodHelper/archive/2009/11/20/SpringNet_Index.html" target="_top">返回目录</a></p><div id="EntryTag">Tag标签: <a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/">NHibernate</a>,<a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/">Spring.NET</a>,<a href="http://www.cnblogs.com/GoodHelper/tag/ORM/">ORM</a></div>
<div id="digg_block">
<div id="div_digg">										
	<div class="diggit" onclick="DiggIt(1605063,58949,1)"> 
		<span class="diggnum" id="digg_count_1605063">0</span>
	</div>
	<div class="buryit" onclick="DiggIt(1605063,58949,2)"> 
		<span class="burynum" id="bury_count_1605063">0</span>
	</div>
	<div class="clear"></div>
	<span style="display: none;" id="span_isdigged_1605063">0</span>	
	<div class="diggword" id="digg_word_1605063">(请您对文章做出评价)</div>	
</div>
</div>
<div class="clear"></div>
<div id="post_next_prev">
<a href="http://www.cnblogs.com/GoodHelper/archive/2009/11/17/SpringNet_Transaction_Required.html">« </a> 上一篇：<a href="http://www.cnblogs.com/GoodHelper/archive/2009/11/17/SpringNet_Transaction_Required.html" title="发布于2009-11-17 02:25">Spring.NET学习笔记17——事务传播行为(基础篇) Level 200</a><br>
<a href="http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_Nhibernate_AspNetMvc.html">» </a> 下一篇：<a href="http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_Nhibernate_AspNetMvc.html" title="发布于2009-11-19 05:09">Spring.NET学习笔记19——整合NHibernate和ASP.NET MVC(基础篇) Level 300</a><br>
</div>








		</div>
		<div class="postDesc">posted @ 2009-11-18 04:36 <a href="http://www.cnblogs.com/GoodHelper/">刘冬.NET</a> 阅读(1366) <a href="#commentform">评论(4)</a> &nbsp;<a href="http://www.cnblogs.com/GoodHelper/admin/EditPosts.aspx?postid=1605063">编辑</a> <a href="http://www.cnblogs.com/GoodHelper/AddToFavorite.aspx?id=1605063">收藏</a> <a href="#" onclick="PutInWz();return false;">网摘</a>  所属分类: <a href="http://www.cnblogs.com/GoodHelper/category/214139.html">NHibernate</a>, <a href="http://www.cnblogs.com/GoodHelper/category/215413.html">Spring.NET</a></div>
	</div>
	<img src="1605063.html" height="1" width="1">
	
<!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
rdf:about="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html"
dc:identifier="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html"
dc:title=""
trackback:ping="http://www.cnblogs.com/GoodHelper/services/trackbacks/1605063.aspx" />
</rdf:RDF>
-->

</div><!--end: topics 文章、评论容器-->
<a name="pagedcomment"></a>
<!--done-->
<br>
<div class="feedback_area_title">发表评论</div>
<div class="feedbackNoItems"><span id="span_comment_maxid" style="display: none;">1701265</span></div>
	

		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("摆地摊的",1700984,"AdNm5XywLGy7YYrR8muB7mbndwQKS822SVXatXVj/Chr+oTTPSi8Fg==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1700984,"AdNm5XywLGy7YYrR8muB7mbndwQKS822SVXatXVj/Chr+oTTPSi8Fg==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%91%86%e5%9c%b0%e6%91%8a%e7%9a%84" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl00_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl00$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl00_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1700984">#1楼</a><a name="1700984" id="comment_anchor_1700984"></a>2009-11-18 08:11 | <a id="Comments1_CommentList_ctl00_NameLink" href="http://www.cnblogs.com/kivenhou/" target="_top">摆地摊的</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e6%91%86%e5%9c%b0%e6%91%8a%e7%9a%84" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1700984" class="blog_comment_body">神啊！你不睡觉的？</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("DecleorMX",1700991,"1ZNSEbKevH5TDMUXpoMYKmHq/WWX0pVQmiovPSbOX6BtoCLM3aLQ6Q==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1700991,"1ZNSEbKevH5TDMUXpoMYKmHq/WWX0pVQmiovPSbOX6BtoCLM3aLQ6Q==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=DecleorMX" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl01_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl01$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl01_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1700991">#2楼</a><a name="1700991" id="comment_anchor_1700991"></a>2009-11-18 08:26 | <a id="Comments1_CommentList_ctl01_NameLink" href="http://www.cnblogs.com/xiebbs/" target="_top">DecleorMX</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/DecleorMX" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1700991" class="blog_comment_body">04:36 , 强。。</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("fang_regal",1701079,"HtityKlnFFoJw1/Rd0JSrxRSX5ae+4YybYHVuUFBnQXsqsIUVFPNqw==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1701079,"HtityKlnFFoJw1/Rd0JSrxRSX5ae+4YybYHVuUFBnQXsqsIUVFPNqw==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=fang_regal" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl02_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl02$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl02_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1701079">#3楼</a><a name="1701079" id="comment_anchor_1701079"></a>2009-11-18 09:30 | <a id="Comments1_CommentList_ctl02_NameLink" href="http://home.cnblogs.com/78943/" target="_top">fang_regal</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/fang_regal" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1701079" class="blog_comment_body">哥们你厉害！佩服！<br>继续努力  就冲你这激情 <br>大家得 多多看看！支持。。。</span><br>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<a onclick='ReplyComment("莫耶",1701265,"sink0o3KA7smWGW/49u72/w+ZkDC2ZnLo/vhbIKfl9IgRANFImy4WQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html#commentform">回复</a>&nbsp;&nbsp;<a onclick='QuoteComment(1701265,"sink0o3KA7smWGW/49u72/w+ZkDC2ZnLo/vhbIKfl9IgRANFImy4WQ==")' href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html#commentform">引用</a>&nbsp;&nbsp;<a title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e8%8e%ab%e8%80%b6" target="_top">查看</a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl03_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl03$DeleteLink','')"></a>&nbsp;&nbsp;<a id="Comments1_CommentList_ctl03_EditLink" causesvalidation="False"></a>
				</div>
				<a href="#1701265">#5楼</a><a name="1701265" id="comment_anchor_1701265"></a><a name="Post"></a>2009-11-18 11:03 | <a id="Comments1_CommentList_ctl03_NameLink" href="http://www.cnblogs.com/moye/" target="_top">莫耶</a>&nbsp;<a href="http://space.cnblogs.com/msg/send/%e8%8e%ab%e8%80%b6" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<span id="comment_body_1701265" class="blog_comment_body">不错</span><br>
			</div>
		</div>
	

<div id="ctl05_comment_form" class="commentform">




<div id="ctl05_divLoginPannel">
<div class="login_tips">注册用户登录后才能发表评论，请 <a href="http://passport.cnblogs.com/login.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fGoodHelper%2farchive%2f2009%2f11%2f18%2fSpringNet_NHibernate.html%3flogin%3d1%23commentform" class="underline">登录</a> 或 <a href="http://passport.cnblogs.com/register.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fGoodHelper%2farchive%2f2009%2f11%2f18%2fSpringNet_NHibernate.html%23Bottom2" class="underline">注册</a> 。</div>
</div>

<div class="itnews c_ad_block" id="itnews">
<a href="http://news.cnblogs.com/" target="_top">IT新闻</a>:<br>

          ·  <a href="http://news.cnblogs.com/n/55140/" target="_top">《星际争霸2》"刀锋女王"重金属主题音乐视频</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55139/" target="_top">中国站长最郁闷的几件事情</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55138/" target="_top">苹果Vs谷歌：手机领域谁怕谁？</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55137/" target="_top">摩托罗拉：豪赌Android的希望与隐忧</a><br>
	
          ·  <a href="http://news.cnblogs.com/n/55136/" target="_top">分众新坐标：楼宇是过去 未来在手机和互联网</a><br>
	
</div>


<div id="ad_under_comment" class="c_ad_block">
<a href="http://a4.yeshj.com/rd/34138/" target="_top">每天10分钟，轻松学英语</a><br><br>
<div id="google_ads_div_cnblogs_blogpost_bottom1">
<iframe src="index_2.html" style="border: 0pt none ;" marginheight="0" marginwidth="0" name="google_ads_iframe_cnblogs_blogpost_bottom1" id="google_ads_iframe_cnblogs_blogpost_bottom1" scrolling="no" frameborder="0" height="60" width="468"></iframe></div>

<br>
<div id="google_ads_div_cnblogs_blogpost_bottom">
<iframe src="index_3.html" style="border: 0pt none ;" marginheight="0" marginwidth="0" name="google_ads_iframe_cnblogs_blogpost_bottom" id="google_ads_iframe_cnblogs_blogpost_bottom" scrolling="no" frameborder="0" height="250" width="300"></iframe></div>

</div>
<div id="site_nav_under" class="c_ad_block">
网站导航：<br>
<a href="http://www.cnblogs.com/" target="_top">博客园首页</a> &nbsp;<a href="http://news.cnblogs.com/" target="_top">IT新闻</a> &nbsp;<a href="http://home.cnblogs.com/" target="_top">个人主页</a> &nbsp;<a href="http://home.cnblogs.com/ing/" target="_top">闪存</a> &nbsp;<a href="http://job.cnblogs.com/" target="_top">程序员招聘</a> &nbsp;<a href="http://space.cnblogs.com/" target="_top">社区</a> &nbsp;<a href="http://space.cnblogs.com/q/" target="_top">博问</a> &nbsp;<a href="http://wz.cnblogs.com/" target="_top">网摘</a>
</div>
<div id="ad_under_comment2" class="c_ad_block">
<a href="http://www.china-pub.com/STATIC07/0912/zh_ndcx_091212.asp" target="_top"><img src="chinapub_20091222.jpg" alt="" style="border: 0px none ;"></a><br>
<a href="http://www.china-pub.com/itbook/" target="_top">China-pub 计算机图书网上专卖店！6.5万品种2-8折！</a><br>
<a href="http://www.china-pub.com/static07/0901/zh_jueba_090121.asp" target="_top">China-Pub 计算机绝版图书按需印刷服务</a><br>
</div>

<div id="relative_search"><br><b>相关搜索:</b><br> <a href="http://zzk.cnblogs.com/s?w=NHibernate" target="_top">NHibernate</a> <a href="http://zzk.cnblogs.com/s?w=Spring.NET" target="_top">Spring.NET</a> <a href="http://zzk.cnblogs.com/s?w=ORM" target="_top">ORM</a> <a href="http://zzk.cnblogs.com/s?w=NHibernate" target="_top">NHibernate</a> <a href="http://zzk.cnblogs.com/s?w=Spring.NET" target="_top">Spring.NET</a> </div><div id="relative_search"><br><b>在知识库中查看：</b><br> <a href="http://kb.cnblogs.com/a/1605063/">Spring.NET学习笔记18——整合NHibernate(基础篇) Level 300</a></div>

</div>


				
	</div><!--end: forFlow -->
	</div><!--end: mainContent 主体内容容器-->

	<div id="sideBar">
		<div id="sideBarMain">
			
<!--done-->
<div class="newsItem">
<h3 class="catListTitle">公告</h3>
	<div id="profile_block"><a href="http://home.cnblogs.com/GoodHelper/" target="_top">我的主页</a>&nbsp; <a href="http://home.cnblogs.com/GoodHelper/detail/" target="_top">个人资料</a><br><a href="http://home.cnblogs.com/GoodHelper/ing/" target="_top">我的闪存</a>&nbsp; <a href="http://space.cnblogs.com/msg/send/%e5%88%98%e5%86%ac.NET" target="_top">发短消息</a></div>
</div>

			
<div id="calendar">
<table id="Calendar1_entryCal" class="Cal" title="Calendar" border="0" cellpadding="0" cellspacing="0">
	<tbody><tr><td colspan="7"><table class="CalTitle" border="0" cellspacing="0">
		<tbody><tr><td class="CalNextPrev"><a href="javascript:__doPostBack('Calendar1$entryCal','V3622')" style="color: Black;" title="Go to the previous month">&lt;</a></td><td align="center">2010年1月</td><td class="CalNextPrev" align="right"><a href="javascript:__doPostBack('Calendar1$entryCal','V3684')" style="color: Black;" title="Go to the next month">&gt;</a></td></tr>
	</tbody></table></td></tr><tr><th class="CalDayHeader" abbr="日" scope="col" align="center">日</th><th class="CalDayHeader" abbr="一" scope="col" align="center">一</th><th class="CalDayHeader" abbr="二" scope="col" align="center">二</th><th class="CalDayHeader" abbr="三" scope="col" align="center">三</th><th class="CalDayHeader" abbr="四" scope="col" align="center">四</th><th class="CalDayHeader" abbr="五" scope="col" align="center">五</th><th class="CalDayHeader" abbr="六" scope="col" align="center">六</th></tr><tr><td class="CalOtherMonthDay" align="center">27</td><td class="CalOtherMonthDay" align="center">28</td><td class="CalOtherMonthDay" align="center">29</td><td class="CalOtherMonthDay" align="center">30</td><td class="CalOtherMonthDay" align="center">31</td><td align="center">1</td><td class="CalWeekendDay" align="center">2</td></tr><tr><td class="CalWeekendDay" align="center">3</td><td align="center">4</td><td align="center">5</td><td align="center">6</td><td align="center">7</td><td align="center">8</td><td class="CalWeekendDay" align="center">9</td></tr><tr><td class="CalWeekendDay" align="center">10</td><td align="center">11</td><td align="center">12</td><td align="center">13</td><td align="center">14</td><td align="center">15</td><td class="CalWeekendDay" align="center">16</td></tr><tr><td class="CalTodayDay" align="center">17</td><td align="center">18</td><td align="center">19</td><td align="center">20</td><td align="center">21</td><td align="center">22</td><td class="CalWeekendDay" align="center">23</td></tr><tr><td class="CalWeekendDay" align="center">24</td><td align="center">25</td><td align="center">26</td><td align="center">27</td><td align="center">28</td><td align="center">29</td><td class="CalWeekendDay" align="center">30</td></tr><tr><td class="CalWeekendDay" align="center">31</td><td class="CalOtherMonthDay" align="center">1</td><td class="CalOtherMonthDay" align="center">2</td><td class="CalOtherMonthDay" align="center">3</td><td class="CalOtherMonthDay" align="center">4</td><td class="CalOtherMonthDay" align="center">5</td><td class="CalOtherMonthDay" align="center">6</td></tr>
</tbody></table>
</div>

			
			<div id="leftcontentcontainer">
				

<div class="mySearch">
<h3 class="catListTitle">搜索</h3>
<div class="div_my_zzk"><input value="" id="q" onkeydown="return zzk_go_enter(event);" class="input_my_zzk" type="text">&nbsp;<input onclick="zzk_go()" value="找找看" id="btnZzk" class="btn_my_zzk" type="button"></div>
</div>
<div class="catListLink">
<h3 class="catListTitle">常用链接</h3>
<ul>

		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl00_lnkLinkItem" href="http://www.cnblogs.com/GoodHelper/MyPosts.html">我的随笔</a></li>
	
		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl01_lnkLinkItem" href="http://home.cnblogs.com/GoodHelper/">我的空间</a></li>
	
		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl02_lnkLinkItem" href="http://space.cnblogs.com/msg/recent">我的短信</a></li>
	
		<li><a id="SingleColumn1_ctl02_rptMainLinks_ctl03_lnkLinkItem" href="http://www.cnblogs.com/GoodHelper/MyComments.html">我的评论</a></li>
	
<li><a id="itemListLink" onclick="this.blur();WarpClass('itemListLink', 'itemListLin_con');return false;" href="#">更多链接</a></li>
</ul>
<div id="itemListLin_con" style="display: none;">
<ul>

		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl00_lnkLinkItem" title="我发表过评论的随笔" href="http://www.cnblogs.com/GoodHelper/OtherPosts.html">我的参与</a></li>
	
		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl01_lnkLinkItem" href="http://www.cnblogs.com/GoodHelper/MyNews.html">我的新闻</a></li>
	
		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl02_lnkLinkItem" href="http://www.cnblogs.com/GoodHelper/RecentComments.html">最新评论</a></li>
	
		<li><a id="SingleColumn1_ctl02_repeaterLinks_ctl03_lnkLinkItem" href="http://www.cnblogs.com/GoodHelper/tag/">我的标签</a></li>
	
</ul>
</div>
</div>

<div class="catListTag">
<h3 class="catListTitle">我的标签</h3>
<ul>
<li><a href="http://www.cnblogs.com/GoodHelper/tag/Spring.NET/">Spring.NET</a>(30)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/NHibernate/">NHibernate</a>(7)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/AOP/">AOP</a>(7)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/IoC/">IoC</a>(5)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/%e4%be%9d%e8%b5%96%e6%b3%a8%e5%85%a5/">依赖注入</a>(4)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/NVelocity/">NVelocity</a>(4)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/WCF/">WCF</a>(3)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/ASP.NET+MVC/">ASP.NET MVC</a>(3)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/Linq/">Linq</a>(3)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/DI/">DI</a>(3)</li><li><a href="http://www.cnblogs.com/GoodHelper/tag/">更多</a></li>
</ul>
</div>
<div class="catListPostCategory">
<h3 class="catListTitle">随笔分类<span style="font-size: 11px; font-weight: normal;">(36)</span></h3>

<ul>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl01_Link" href="http://www.cnblogs.com/GoodHelper/category/214139.html">NHibernate(7)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl01_RssLink" title="Subscribe to NHibernate(7)" href="http://www.cnblogs.com/GoodHelper/category/214139.html/rss">(rss)</a></li>

<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl02_Link" href="http://www.cnblogs.com/GoodHelper/category/215413.html">Spring.NET(29)</a> <a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl02_RssLink" title="Subscribe to Spring.NET(29)" href="http://www.cnblogs.com/GoodHelper/category/215413.html/rss">(rss)</a></li>

</ul>

</div>

<div class="catListPostArchive">
<h3 class="catListTitle">随笔档案<span style="font-size: 11px; font-weight: normal;">(28)</span></h3>

<ul>

<li><a id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl01_Link" href="http://www.cnblogs.com/GoodHelper/archive/2009/11.html">2009年11月 (20)</a> </li>

<li><a id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl02_Link" href="http://www.cnblogs.com/GoodHelper/archive/2009/10.html">2009年10月 (8)</a> </li>

</ul>

</div>

<div class="catListArticleCategory">
<h3 class="catListTitle">文章分类</h3>

<ul>

<li><a id="SingleColumn1_Categories_CatList_ctl02_LinkList_ctl01_Link" href="http://www.cnblogs.com/GoodHelper/category/214956.html">Spring.NET</a> <a id="SingleColumn1_Categories_CatList_ctl02_LinkList_ctl01_RssLink" title="Subscribe to Spring.NET" href="http://www.cnblogs.com/GoodHelper/category/214956.html/rss">(rss)</a></li>

</ul>

</div>

<div class="catListImageCategory">
<h3 class="catListTitle">相册</h3>

<ul>

<li><a id="SingleColumn1_Categories_CatList_ctl03_LinkList_ctl01_Link" href="http://www.cnblogs.com/GoodHelper/gallery/219559.html">广州宿舍</a> </li>

</ul>

</div>



<div class="catListBlogRank">
<h3 class="catListTitle">积分与排名</h3>
<ul>
	<li class="liScore">
		积分 -	51075
	</li><li class="liRank">
		排名 -	1473
	</li>
</ul>
</div>



<div class="catListEssay">
<h3 class="catListTitle">最新随笔</h3>
<ul>
	
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl00_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/21/SpringNet_blogs.html">1.&nbsp;Spring.NET学习笔记——前言</a></li>
		
			
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl01_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/20/SpringNet_NVelocity.html">2.&nbsp;Spring.NET学习笔记26——整合NVelocity(应用篇) Level 200</a></li>
		
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl01_RecentPostsList2_ctl01_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/20/SpringNet_Index.html">3.&nbsp;Spring.NET学习笔记——目录(原)</a></li>
		
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl01_RecentPostsList2_ctl02_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/20/SpringNet_QuartzNet.html">4.&nbsp;Spring.NET学习笔记25——整合Quartz.NET(应用篇) Level 200</a></li>
		
			
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl02_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_WebService.html">5.&nbsp;Spring.NET学习笔记21——整合Web Service(应用篇) Level 200</a></li>
		
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl02_RecentPostsList2_ctl01_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_Remoting.html">6.&nbsp;Spring.NET学习笔记20——整合Remoting(应用篇) Level 200</a></li>
		
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl02_RecentPostsList2_ctl02_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_Nhibernate_AspNetMvc.html">7.&nbsp;Spring.NET学习笔记19——整合NHibernate和ASP.NET MVC(基础篇) Level 300</a></li>
		
			
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl03_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/18/SpringNet_NHibernate.html">8.&nbsp;Spring.NET学习笔记18——整合NHibernate(基础篇) Level 300</a></li>
		
			
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl04_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/17/SpringNet_Transaction_Required.html">9.&nbsp;Spring.NET学习笔记17——事务传播行为(基础篇) Level 200</a></li>
		
			
	
			<li><a id="SingleColumn1_ctl06_RecentPostsList_ctl05_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Transaction.html">10.&nbsp;Spring.NET学习笔记16——事务管理(应用篇) Level 200</a></li>
		
		
</ul>
</div>

<div class="catListComment">
<h3 class="catListTitle">最新评论<a id="SingleColumn1__1c5f994_RSSHyperlink1" title="RSS订阅最最新评论" href="http://www.cnblogs.com/GoodHelper/CommentsRSS.aspx"><img title="RSS订阅最最新评论" src="xml.gif" style="border-width: 0px;"></a></h3>

	
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__1c5f994_CommentList_ctl00_Hyperlink2" class="listitem" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/16/SpringNet_Transaction.html#1746723">1.&nbsp;Re:Spring.NET学习笔记16——事务管理(应用篇) Level 200</a>
			</div>
			<div class="divRecentComment">
				这么好的文章为啥没人评论呢？
一直看楼主的这一系列文章，写的很好，对我有很大帮助。
再次感谢楼主，希望能多出好文章。 (轻风随风)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__1c5f994_CommentList_ctl01_Hyperlink2" class="listitem" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_Nhibernate_AspNetMvc.html#1746697">2.&nbsp;Re:Spring.NET学习笔记19——整合NHibernate和ASP.NET MVC(基础篇) Level 300</a>
			</div>
			<div class="divRecentComment">
				今天带给大家的就是期待以久的ASP.NET MVC与Spring.NET和NHibernate的组合，视图打造.NET版的SSH(Spring-Struts-Hibernate)

很好很强大！ (shmilgmy)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__1c5f994_CommentList_ctl02_Hyperlink2" class="listitem" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/21/SpringNet_blogs.html#1746691">3.&nbsp;Re:Spring.NET学习笔记——前言</a>
			</div>
			<div class="divRecentComment">
				支持！期待lz王者归来:) (shmilgmy)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__1c5f994_CommentList_ctl03_Hyperlink2" class="listitem" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/11/SpringNet_Life.html#1741365">4.&nbsp;Re:Spring.NET学习笔记11——自定义对象行为(基础篇) Level 200</a>
			</div>
			<div class="divRecentComment">
				有点迷糊了，第二部分没看明白。
莫非只是“配置”上的继承，仅是为了简化配置的编写？ (鹤冲天)
			</div>		
		
			<div class="divRecentCommentAticle">
				<a id="SingleColumn1__1c5f994_CommentList_ctl04_Hyperlink2" class="listitem" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/11/SpringNet_Method.html#1741362">5.&nbsp;Re:Spring.NET学习笔记10——方法的注入(基础篇) Level 200</a>
			</div>
			<div class="divRecentComment">
				不可思议，没想到.Net也能这样用！ (鹤冲天)
			</div>		
		
</div>

<div class="catListView">
<h3 class="catListTitle">阅读排行榜</h3>
	
			<ul>
		
			<li>
				<a id="SingleColumn1_ctl08_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/10/SpringNET_Framework_Step1.html">1.&nbsp;Spring.NET企业架构实践之 JQuery +  FlexiGrid + ASP.NET MVC + NVelocity + WCF + LINQ + NHibernate 综合应用(4064)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl08_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/25/Spring_NET_IoC.html">2.&nbsp;Spring.NET学习笔记1——控制反转(基础篇) Level 200(3088)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl08_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/16/linq2nhibernate.html">3.&nbsp;10分钟搞定Linq to NHibernate(一)——环境篇(2869)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl08_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/25/SpringNET_Config.html">4.&nbsp;Spring.NET学习笔记2——环境搭建(基础篇) Level 200(2468)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl08_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/25/SpringNET_Create.html">5.&nbsp;Spring.NET学习笔记4——对象的创建(基础篇) Level 200(1948)</a>
			</li>
		
			</ul>
		
</div>

<div class="catListFeedback">
<h3 class="catListTitle">评论排行榜</h3>
	
			<ul>
		
			<li>
				<a id="SingleColumn1_ctl09_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/11/10/SpringNET_Framework_Step1.html">1.&nbsp;Spring.NET企业架构实践之 JQuery +  FlexiGrid + ASP.NET MVC + NVelocity + WCF + LINQ + NHibernate 综合应用(29)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl09_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/16/linq2nhibernate.html">2.&nbsp;10分钟搞定Linq to NHibernate(一)——环境篇(28)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl09_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/25/Spring_NET_IoC.html">3.&nbsp;Spring.NET学习笔记1——控制反转(基础篇) Level 200(22)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl09_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/25/SpringNET_Create.html">4.&nbsp;Spring.NET学习笔记4——对象的创建(基础篇) Level 200(19)</a>
			</li>
		
			<li>
				<a id="SingleColumn1_ctl09_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/GoodHelper/archive/2009/10/26/SpringNET_DI.html">5.&nbsp;Spring.NET学习笔记6——依赖注入(应用篇) Level 300(17)</a>
			</li>
		
			</ul>
		
</div>

			</div>
			
		</div><!--end: sideBarMain -->
	</div><!--end: sideBar 侧边栏容器 -->
	<div class="clear"></div>
	</div><!--end: main -->
	<div class="clear"></div>
	<div id="footer">
		
<!--done-->
Copyright ©2010 刘冬.NET
	</div><!--end: footer -->
</div><!--end: home 自定义的最大容器 --><a href="http://www.cnzz.com/stat/website.php?web_id=1738003" target="_top" title="站长统计"><img src="pic1.gif" border="0" hspace="0" vspace="0"></a><img src="stat.htm" border="0" height="0" width="0">

    </form>
	
	
      
    
    
    
</body>
</html>
